package com.battery.system.service.battery;

import java.math.BigDecimal;
import java.util.List;

import com.battery.common.utils.BatteryJSONResult;
import com.battery.common.utils.ali.AliPayEntity;
import com.battery.system.domain.AppUser;
import com.battery.system.domain.Order;
import com.battery.system.domain.RefundOrder;
import com.battery.system.service.IBaseService;
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;

/**
 * 退款订单Service接口
 *
 * @author battery
 * @date 2021-01-22
 */
public interface IRefundOrderService extends IBaseService<RefundOrder> {
    /**
     * 查询退款订单
     *
     * @param id 退款订单ID
     * @return 退款订单
     */
    public RefundOrder selectRefundOrderById(String id);

    /**
     * 查询退款订单列表
     *
     * @param refundOrder 退款订单
     * @return 退款订单集合
     */
    public List<RefundOrder> selectRefundOrderList(RefundOrder refundOrder);

    /**
     * 新增退款订单
     *
     * @param refundOrder 退款订单
     * @return 结果
     */
    public int insertRefundOrder(RefundOrder refundOrder);

    /**
     * 修改退款订单
     *
     * @param refundOrder 退款订单
     * @return 结果
     */
    public int updateRefundOrder(RefundOrder refundOrder);

    /**
     * 批量删除退款订单
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteRefundOrderByIds(String ids);

    /**
     * 删除退款订单信息
     *
     * @param id 退款订单ID
     * @return 结果
     */
    public int deleteRefundOrderById(String id);

    /**
     * 微信小程序用户退押操作
     *
     * @param appUser       用户信息
     * @param noUsedDeposit 微信用户押金
     * @param refund_fee    退押金额
     * @return
     */
    BatteryJSONResult wxRefundDeposit(AppUser appUser, Order noUsedDeposit, BigDecimal refund_fee);

    /**
     * 根据退款单号查询对应的退款订单
     *
     * @param out_refund_no
     * @return
     */
    RefundOrder selectByOutRefundNo(String out_refund_no);


    /**
     * 退款回调处理
     *
     * @param refundOrder 退款订单
     * @param reqInfo     退款回调信息
     * @return
     */
    int operationWxRefundNotify(RefundOrder refundOrder, WxPayRefundNotifyResult.ReqInfo reqInfo);


    /**
     * 支付宝退押金
     *
     * @param appUser
     * @param noUsedDeposit
     * @param refund_fee
     * @param entity
     * @return
     */
    BatteryJSONResult aliRefundDeposit(AppUser appUser, Order noUsedDeposit, BigDecimal refund_fee, AliPayEntity entity);
}
